<?php
/**
 * @Copyright Copyright (C) 2010-2012
 * @license GNU/GPL http://www.gnu.org/copyleft/gpl.html
 + Created by:          Webit Solution
 * Company:		Webit Solution
 + Contact:		www.webits.asia, developer@webits.asia
 * Created on:	Mar 21, 2012
 ^
 + Project: 		WRecruit
 * File Name:	getform.php
 ^ 
 * Description: Entry point file for the default controller file
 ^ 
 * History:		NONE
 ^ 
 */

defined('_JEXEC') or die('Restricted access');
jimport('joomla.application.component.controller');
 class WRecruitControllerWrgetform extends JController {
	function __construct()
	{   
		$user	=& JFactory::getUser();
                
		if ($user->guest) { // redirect user if not login
			$link = 'index.php?option=com_user';
                       
			$this->setRedirect($link);
			
		} 

		parent :: __construct();
	}
	function getformedite(){
		$document = & JFactory :: getDocument();
		$viewName = JRequest :: getVar('view', 'resume');
		$layoutName = JRequest :: getVar('layout', 'jobcat');
		$viewType = $document->getType();                
		$model = $this->getModel('wrecruit', 'WRecruitModel');
		$view = & $this->getView($viewName, $viewType);
		if (!JError :: isError($model))
		{   
		    $user	=& JFactory::getUser();
			if($user->id==''){
				
				echo "<div style='margin:15px;'><center>Please login to access candidate area! <a href=\"index.php?option=com_users&view=login\">".JText::_('JLOGIN')."</a></center></div>";
				$app =& JFactory::getApplication(); 
	            $app->enqueueMessage( JText::_( 'Please <a href="index.php?option=com_users&view=login">Login</a>' ), 'Login access' );
			}
			$view->setModel($model, true);
		}
		$view->setLayout($layoutName);
		$view->display();
	}
	
	/**
	 * @author Bunthan
	 */
	function empformview() {
		$document = & JFactory :: getDocument();
		$viewName = JRequest :: getVar('view', 'employer');
		$layoutName = JRequest :: getVar('layout', 'popuppages');
		$viewType = $document->getType();                
		$model = $this->getModel('wrecruit', 'WRecruitModel');
		$view = & $this->getView($viewName, $viewType);
		if (!JError :: isError($model))
		{
			$view->setModel($model, true);
		}
		$view->setLayout($layoutName);
		$view->display();
	}
	//end Bunthan
	
	
	function display()
	{
		
		//$document = & JFactory :: getDocument();
		//$viewName = JRequest :: getVar('view', 'resume');
		//$layoutName = JRequest :: getVar('layout', 'jobcat');
		//$viewType = $document->getType();                
		//$model = $this->getModel('wrecruit', 'WRecruitModel');
		//$view = & $this->getView($viewName, $viewType);
		//if (!JError :: isError($model))
		//{
			//$view->setModel($model, true);
		//}
		//$view->setLayout($layoutName);
		//$view->display();
		
	}
 }
?>